home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Aventura / redbeard.swf / scripts / frame_3 / PlaceObject2_76_9 / CLIPACTIONRECORD onClipEvent(enterFrame).as next >
Encoding:
Text File  |  2008-09-12  |  10.4 KB  |  367 lines

  1. onClipEvent(enterFrame){
  2.    if(checked == "done")
  3.    {
  4.       time = getTimer();
  5.       checked = "checking";
  6.    }
  7.    frame += 1;
  8.    if(getTimer() - time > 1000)
  9.    {
  10.       FPS = frame;
  11.       checked = "done";
  12.       frame = 0;
  13.       if(FPS < 20 and _quality == "HIGH")
  14.       {
  15.          _quality = "MEDIUM";
  16.       }
  17.       if(FPS > 25 and _quality == "MEDIUM")
  18.       {
  19.          _quality = "HIGH";
  20.       }
  21.    }
  22.    if(collected == "red")
  23.    {
  24.       purplegems = 0;
  25.       bluegems = 0;
  26.       collected = "none";
  27.       colourActive = "none";
  28.    }
  29.    if(collected == "purple")
  30.    {
  31.       redgems = 0;
  32.       bluegems = 0;
  33.       collected = "none";
  34.       colourActive = "none";
  35.    }
  36.    if(collected == "blue")
  37.    {
  38.       purplegems = 0;
  39.       redgems = 0;
  40.       collected = "none";
  41.       colourActive = "none";
  42.    }
  43.    if(redgems >= redNeeded and redneeded != "X")
  44.    {
  45.       colourActive = "red";
  46.    }
  47.    if(bluegems >= blueNeeded and blueneeded != "X")
  48.    {
  49.       colourActive = "blue";
  50.    }
  51.    if(purplegems >= purpleNeeded and purpleneeded != "X")
  52.    {
  53.       colourActive = "purple";
  54.    }
  55.    if(bonusScore > levelComplete and levelBoardDone == "TRUE")
  56.    {
  57.       bonusScore -= 10;
  58.    }
  59.    if(levelBoardDone == "TRUE")
  60.    {
  61.       Testscore += 10;
  62.    }
  63.    if(getProperty("_root.waterMC", _X) < -670)
  64.    {
  65.       setProperty("_root.waterMC", _X, 0);
  66.       setProperty("_root.waterBackMC", _X, 0);
  67.    }
  68.    waterHeight -= waterSpeed;
  69.    setProperty("_root.waterMC", _X, getProperty("_root.waterMC", _X) - 20);
  70.    setProperty("_root.waterBackMC", _X, getProperty("_root.waterBackMC", _X) - 20);
  71.    setProperty("_root.waterMC", _Y, getProperty("_root.BackgroundMC", _Y) + waterheight + 522);
  72.    setProperty("_root.waterBackMC", _Y, getProperty("_root.BackgroundMC", _Y) + waterheight + 510);
  73.    if(getProperty("_root.playerMC", _Y) - 20 > getProperty("_root.waterMC", _Y))
  74.    {
  75.       Air -= drownRate;
  76.       if(Air < 0)
  77.       {
  78.          state = "dead";
  79.       }
  80.    }
  81.    else
  82.    {
  83.       Air = 5;
  84.    }
  85.    if(enemyCol == "on" and invincibleTimer != "on")
  86.    {
  87.       enemyCol = "off";
  88.       state = "dead";
  89.    }
  90.    if(invincibleTimer == "on" and nInvincible < 180)
  91.    {
  92.       nInvincible += 1;
  93.       enemyCol = "off";
  94.       setProperty("_root.counterMC.invincibleMC", _visible, true);
  95.    }
  96.    else
  97.    {
  98.       nInvincible = 0;
  99.       invincibleTimer = "off";
  100.       setProperty("_root.counterMC.invincibleMC", _visible, false);
  101.    }
  102.    if(state == "dead")
  103.    {
  104.       if(deadSound != "played")
  105.       {
  106.          _root.dead.start();
  107.          deadSound = "played";
  108.       }
  109.       if(getProperty("_root.playerMC", _Y) < 750)
  110.       {
  111.          setProperty("_root.playerMC", _Y, getProperty("_root.playerMC", _Y) - 16 + deathspeed);
  112.          deathspeed += 3;
  113.       }
  114.       else
  115.       {
  116.          _root.score = score;
  117.          lives -= 1;
  118.          state = "Stopped";
  119.          set("_root.codeMC:blueSwitch","off");
  120.          set("_root.codeMC:redSwitch","off");
  121.          set("_root.codeMC:purpleSwitch","off");
  122.          air = 5;
  123.          redgems = 0;
  124.          bluegems = 0;
  125.          purplegems = 0;
  126.          colourActive = "none";
  127.          currentGround = 500;
  128.          setProperty("_root.backgroundMC", _X, 0);
  129.          setProperty("_root.backgroundMC", _Y, 0);
  130.          setProperty("_root.playerMC", _X, 197.2);
  131.          setProperty("_root.playerMC", _Y, 97);
  132.          _root.levelBoardMC.play();
  133.          _root.backgroundMC.gotoAndPlay(currentlevel);
  134.          deathspeed = 0;
  135.          deadSound = "waiting";
  136.       }
  137.    }
  138.    if(state == "Stopped")
  139.    {
  140.       if(left == "on")
  141.       {
  142.          direction = -1;
  143.          speed = 1;
  144.          currentJumpHeight = jumpHeight;
  145.          state = "Accelerate";
  146.       }
  147.       if(right == "on")
  148.       {
  149.          direction = 1;
  150.          speed = 1;
  151.          currentJumpHeight = jumpHeight;
  152.          state = "Accelerate";
  153.       }
  154.    }
  155.    if(state == "Skid")
  156.    {
  157.       speed -= 2;
  158.       if(speed <= 0)
  159.       {
  160.          state = "Stopped";
  161.       }
  162.       if(getProperty("_root.playerMC", _X) > scrollPoint and direction == 1 or getProperty("_root.playerMC", _X) < scrollPointLeft and direction == -1)
  163.       {
  164.          if(getProperty("_root.playerMC", _X) > scrollPoint and direction == 1)
  165.          {
  166.             setProperty("_root.backgroundMC", _X, getProperty("_root.backgroundMC", _X) - direction * speed);
  167.          }
  168.          if(getProperty("_root.playerMC", _X) < scrollPointLeft and direction == -1)
  169.          {
  170.             setProperty("_root.backgroundMC", _X, getProperty("_root.backgroundMC", _X) - direction * speed);
  171.          }
  172.       }
  173.       else
  174.       {
  175.          setProperty("_root.playerMC", _X, getProperty("_root.playerMC", _X) + direction * speed);
  176.       }
  177.    }
  178.    if(state == "Inertia")
  179.    {
  180.       speed -= 1;
  181.       if(getProperty("_root.playerMC", _X) > scrollPoint and direction == 1 or getProperty("_root.playerMC", _X) < scrollPointLeft and direction == -1)
  182.       {
  183.          if(getProperty("_root.playerMC", _X) > scrollPoint and direction == 1)
  184.          {
  185.             setProperty("_root.backgroundMC", _X, getProperty("_root.backgroundMC", _X) - direction * speed);
  186.          }
  187.          if(getProperty("_root.playerMC", _X) < scrollPointLeft and direction == -1)
  188.          {
  189.             setProperty("_root.backgroundMC", _X, getProperty("_root.backgroundMC", _X) - direction * speed);
  190.          }
  191.       }
  192.       else
  193.       {
  194.          setProperty("_root.playerMC", _X, getProperty("_root.playerMC", _X) + direction * speed);
  195.       }
  196.       if(direction == 1 and eval("_root.CodeMC:left") == "on")
  197.       {
  198.          state = "Stopped";
  199.       }
  200.       if(direction == -1 and eval("_root.CodeMC:right") == "on")
  201.       {
  202.          state = "Stopped";
  203.       }
  204.       if(speed == 0)
  205.       {
  206.          state = "Stopped";
  207.       }
  208.    }
  209.    if(state == "Move")
  210.    {
  211.       if(getProperty("_root.playerMC", _X) > scrollPoint and direction == 1 or getProperty("_root.playerMC", _X) < scrollPointLeft and direction == -1)
  212.       {
  213.          if(getProperty("_root.playerMC", _X) > scrollPoint and direction == 1)
  214.          {
  215.             setProperty("_root.backgroundMC", _X, getProperty("_root.backgroundMC", _X) - direction * speed);
  216.          }
  217.          if(getProperty("_root.playerMC", _X) < scrollPointLeft and direction == -1)
  218.          {
  219.             setProperty("_root.backgroundMC", _X, getProperty("_root.backgroundMC", _X) - direction * speed);
  220.          }
  221.       }
  222.       else
  223.       {
  224.          setProperty("_root.playerMC", _X, getProperty("_root.playerMC", _X) + direction * speed);
  225.       }
  226.       if(direction == -1 and left == "off")
  227.       {
  228.          state = "Inertia";
  229.       }
  230.       if(direction == 1 and right == "off")
  231.       {
  232.          state = "Inertia";
  233.       }
  234.    }
  235.    if(state == "Accelerate")
  236.    {
  237.       speed += 1;
  238.       if(getProperty("_root.playerMC", _X) > scrollPoint and direction == 1 or getProperty("_root.playerMC", _X) < scrollPointLeft and direction == -1)
  239.       {
  240.          if(getProperty("_root.playerMC", _X) > scrollPoint and direction == 1)
  241.          {
  242.             setProperty("_root.backgroundMC", _X, getProperty("_root.backgroundMC", _X) - direction * speed);
  243.          }
  244.          if(getProperty("_root.playerMC", _X) < scrollPointLeft and direction == -1)
  245.          {
  246.             setProperty("_root.backgroundMC", _X, getProperty("_root.backgroundMC", _X) - direction * speed);
  247.          }
  248.       }
  249.       else
  250.       {
  251.          setProperty("_root.playerMC", _X, getProperty("_root.playerMC", _X) + direction * speed);
  252.       }
  253.       if(direction == -1 and left == "off")
  254.       {
  255.          state = "Inertia";
  256.       }
  257.       if(direction == 1 and right == "off")
  258.       {
  259.          state = "Inertia";
  260.       }
  261.       if(speed == Move)
  262.       {
  263.          state = "Move";
  264.       }
  265.    }
  266.    if(getProperty("_root.playerMC", _Y) < currentGround and jumping == "off" and state != "dead")
  267.    {
  268.       fallspeed += 2;
  269.       falling = "on";
  270.       if(fallspeed > gravity)
  271.       {
  272.          fallspeed = gravity;
  273.       }
  274.       if(getProperty("_root.playerMC", _Y) + fallspeed >= currentGround)
  275.       {
  276.          setProperty("_root.playerMC", _Y, currentGround - 1);
  277.          fallspeed = 0;
  278.       }
  279.       if(getProperty("_root.playerMC", _Y) + fallspeed > scrollPointLower)
  280.       {
  281.          setProperty("_root.backgroundMC", _Y, getProperty("_root.backgroundMC", _Y) - fallspeed);
  282.       }
  283.       else
  284.       {
  285.          setProperty("_root.playerMC", _Y, getProperty("_root.playerMC", _Y) + fallspeed);
  286.       }
  287.    }
  288.    else
  289.    {
  290.       fallspeed = 0;
  291.       falling = "off";
  292.    }
  293.    if(platformActive == 0)
  294.    {
  295.       currentGround = 400;
  296.    }
  297.    if(lastjump == "off" and state != "tutorial" and jump == "on" and fallspeed == 0 and jumping == "off")
  298.    {
  299.       jumping = "on";
  300.       _root.jump.start();
  301.    }
  302.    if(jumping == "on" and jumpSpeed < currentJumpHeight)
  303.    {
  304.       jumpSpeed += 2;
  305.       if(jump ne "on")
  306.       {
  307.          currentJumpHeight -= 2;
  308.       }
  309.       if(getProperty("_root.playerMC", _Y) < scrollPointUpper)
  310.       {
  311.          setProperty("_root.backgroundMC", _Y, getProperty("_root.backgroundMC", _Y) + currentJumpHeight - jumpSpeed);
  312.       }
  313.       else
  314.       {
  315.          setProperty("_root.playerMC", _Y, getProperty("_root.playerMC", _Y) - currentJumpHeight + jumpSpeed);
  316.       }
  317.    }
  318.    else
  319.    {
  320.       jumping = "off";
  321.       jumpSpeed = 0;
  322.       currentJumpHeight = jumpHeight;
  323.    }
  324.    if(direction == 1)
  325.    {
  326.       if(state != "Stopped" and jumping == "off" and state != "dead")
  327.       {
  328.          _root.playerMC.gotoAndStop("right");
  329.       }
  330.       if(jumping == "on")
  331.       {
  332.          _root.playerMC.gotoAndStop("jump right");
  333.       }
  334.       if(state == "Stopped" and jumping == "off")
  335.       {
  336.          _root.playerMC.gotoAndStop("stopped right");
  337.       }
  338.       if(state == "tutorial")
  339.       {
  340.          _root.playerMC.gotoAndStop("stopped right");
  341.       }
  342.    }
  343.    if(direction == -1)
  344.    {
  345.       if(state != "Stopped" and jumping == "off" and state != "dead")
  346.       {
  347.          _root.playerMC.gotoAndStop("left");
  348.       }
  349.       if(jumping == "on")
  350.       {
  351.          _root.playerMC.gotoAndStop("jump left");
  352.       }
  353.       if(state == "Stopped" and jumping == "off")
  354.       {
  355.          _root.playerMC.gotoAndStop("stopped left");
  356.       }
  357.       if(state == "tutorial")
  358.       {
  359.          _root.playerMC.gotoAndStop("stopped right");
  360.       }
  361.    }
  362.    if(state == "dead")
  363.    {
  364.       _root.playerMC.gotoAndStop("death");
  365.    }
  366. }
  367.